package com.smedi.ismedi.inmail.core.port.adapter.restful;

import com.smedi.ismedi.inmail.api.dto.request.OperationLogCreateRequest;
import com.smedi.ismedi.inmail.api.feign.RemoteOperationLogFeignApi;
import com.smedi.ismedi.inmail.core.application.command.OperationLogCreateCommand;
import com.smedi.ismedi.inmail.core.application.service.OperationLogApplicationService;
import com.smedi.ismedi.inmail.core.port.adapter.convert.AdapterConverter;
import com.smedi.ismedi.web.starter.common.ResponseData;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通知公告Controller
 *
 * @author jiangqinxuan
 * @date 2021/07/26
 */
@AllArgsConstructor
@RestController
public class OperationLogController implements RemoteOperationLogFeignApi {
    private final OperationLogApplicationService operationLogApplicationService;

    private final AdapterConverter adapterConverter;

    @Override
    public ResponseData<Long> create(OperationLogCreateRequest operationLogCreateRequest) {
        OperationLogCreateCommand operationLogCreateCommand = adapterConverter.operationLogCreateRequestToOperationLogCreateCommand(operationLogCreateRequest);
        return new ResponseData<>().success(operationLogApplicationService.create(operationLogCreateCommand));
    }
}
